package com.gzh.teaching.service.dto;

import com.gzh.core.dao.po.TopicEntity;
import com.gzh.core.util.NumericHelper;
import com.gzh.core.util.StringUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Setter
@Getter
@ToString
@NoArgsConstructor
public class TopicInfo {

  private String topicId;
  private String userId;
  private String userName;
  private String createDate;
  private String createTime;
  private String content;
  private String title;
  private String isTeacher;
  private String likeCount;
  private String isLike;
  private String isMine;

  public TopicInfo(TopicEntity entity) {
    this.topicId  = StringUtils.toString(entity.getTopicId());
    this.userId  = StringUtils.toString(entity.getUserId());
    this.createDate  = StringUtils.toString(entity.getCreateDate());
    this.createTime  = StringUtils.toString(entity.getCreateTime());
    this.likeCount  = StringUtils.toString(NumericHelper.zeroNull(entity.getLikeCount()));
    this.content  = entity.getContent();
    this.title  = entity.getTitle();
  }
}
